//
//  BVmyode.m
//  BuyVegetable
//
//  Created by zhuzi on 16/11/7.
//  Copyright © 2016年 com.yinding. All rights reserved.
//

#import "BVLoginoutMyOrder.h"

@implementation BVLoginoutMyOrder

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
-(id)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        
        [self addLogoutView];
    }
    return self;
}
- (void)addLogoutView {
    
    self.backgroundColor = [UIColor BVBackgroundLightGrayColor];
    
    UIImageView *header = [[UIImageView alloc] init];
    [header setFrame:CGRectMake((ScreenW - 200)/2, 50, 200, 200)];
    [header setImage:[UIImage imageNamed:@"gouwucheweidenglu"]];
    [self addSubview:header];
    header.sd_layout
    .topSpaceToView(self,50)
    .centerXIs(self.centerX)
    .widthIs(200)
    .heightIs(200);
    
    UILabel *titleLabel = [[UILabel alloc] init];
    [self addSubview:titleLabel];
    titleLabel.font = [UIFont systemFontOfSize:20];
    titleLabel.textColor = [UIColor BVTextLightGrayColor];
    titleLabel.textAlignment = NSTextAlignmentCenter;
    titleLabel.text = @"您还没有登录哦~";
    titleLabel.sd_layout
    .topSpaceToView(header,10)
    .centerXIs(self.centerX)
    .heightIs(40);
    [titleLabel setSingleLineAutoResizeWithMaxWidth:200];
    
    UIButton *loginButton = [[UIButton alloc] init];
    [loginButton setTitle:@"登录" forState:UIControlStateNormal];
    [loginButton setBackgroundColor:[UIColor BVBaseOrangeColor]];
    loginButton.tag = 666;
    loginButton.layer.masksToBounds = YES;
    loginButton.layer.cornerRadius = 3.0;
    [loginButton addTarget:self action:@selector(buttonClick:) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:loginButton];
    loginButton.sd_layout
    .topSpaceToView(titleLabel,20)
    .leftSpaceToView(self,20)
    .rightSpaceToView(self,20)
    .heightIs(40);
    
}
#pragma mark -
#pragma mark - 我的订单为空或未登录按钮点击事件
- (void)buttonClick:(UIButton *)button {
    if (self.logoutBlock) {
        self.logoutBlock();
    }
}

@end
